#ifndef __FOC_H
#define __FOC_H

#include <stdint.h>
#include "arm_math.h"

#define SQRT3_BY2 (float)(0.866025403788f)  // Defines value for sqrt(3)/2
#define ONE_BY_SQRT3 (float)(0.5773502691f) // Defines value for 1/sqrt(3)
#define M_PI (float)(3.1415926535f)
#define ANGLE_2PI (2 * M_PI) // Defines value for 2*PI

typedef struct _foc
{
    float angle;
    float sin;
    float cos;
    float ia;
    float ib;
    float ic;
    float ialpha;
    float ibeta;
    float id;
    float iq;
    float vd;
    float vq;
    float valpha;
    float vbeta;

    float pwm_period;
    uint8_t sector;
    float pwma;
    float pwmb;
    float pwmc;
} foc_t;

#endif
